Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / core / barcode / src / main / kotlin / org / meshtastic / core / barcode / SingleScanResultGate.kt

Displaying Raw • Download

core/barcode/src/main/kotlin/org/meshtastic/core/barcode/SingleScanResultGate.kt b4bedd92fcc8d65daff79200d71f6ebc3d8f0cfa (b4bedd92) Text, 1.35 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.barcode

Tff7b72import T7ee787java.util.concurrent.atomic.AtomicBoolean

T8b949e/** Allows a scanner session to complete exactly once, either with a scan result or a dismiss result. */
Tff7b72class T56d364SingleScanResultGate Tb4b4b4{
Tff7b72private Tff7b72val Te6edf3delivered Tff7b72= Te6edf3AtomicBooleanTb4b4b4(Tff7b72falseTb4b4b4)

T8b949e/**
* Attempts to deliver a scanner result once.
*
* The gate is consumed before [onResult] runs. If [onResult] throws, later delivery attempts are still ignored.
*/
Tff7b72fun Td2a8fftryDeliverTb4b4b4(Te6edf3resultTb4b4b4: Tffa657String?Tb4b4b4, Te6edf3onResultTb4b4b4: Tb4b4b4(Tffa657String?Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4)Tb4b4b4: Tffa657Boolean Tb4b4b4{
Tff7b72if Tb4b4b4(Tff7b72!Te6edf3deliveredTb4b4b4.Te6edf3compareAndSetTb4b4b4(Tff7b72falseTb4b4b4, Tff7b72trueTb4b4b4)Tb4b4b4) Tff7b72return Tff7b72false
Te6edf3onResultTb4b4b4(Te6edf3resultTb4b4b4)
Tff7b72return Tff7b72true
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.07s